<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="layout.xhtml">
        <ui:define name="body"> 
            <h2>Pesquisar</h2>
            <p:panel  styleClass="container_24 clearfix " style="background: none; border: none;">
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="3000" />
                    <p class="subtitle">Filtro</p>


                    <p:outputLabel value="Nome :" styleClass="grid_3" />
                    <p:inputText value="#{managerSearchNotaryOffice.notary.nome}" styleClass="grid_20"/>
                    <div class="clear"/>
                    <p:outputLabel value="Titular :" styleClass="grid_3" />
                    <p:inputText value="#{managerSearchNotaryOffice.notary.titular}" styleClass="grid_20"/>

                    <div class="clear"/>
                    
                    <div class="buttonAction">
                        <p:commandButton value="Pesquisar" icon="ui-icon-search" 
                                         actionListener="#{managerSearchNotaryOffice.searchNotaryOffice()}" 
                                         update="@form, table" styleClass="ui-priority-primary"/>
                        <p:commandButton value="Cancelar" icon="ui-icon-close" 
                                         actionListener="#{managerRedirect.redirect('viewNotaryOffice.xhtml')}" 
                                         update="@form"/>
                    </div>

                    <p class="subtitle">Resultado</p>
                    <p:dataTable id="table" value="#{managerSearchNotaryOffice.searchLstNotaryOffices}"
                                 var="c" emptyMessage="Nenhum Cartório"
                                 styleClass="dataTable">                       
                        <f:facet name="header">
                            <h:outputText value="Cartório"/>
                        </f:facet>

                        <p:column headerText="Nome" style="font-size: 12px; width: 300px;">
                            <h:outputText value="#{c.nome}" style="font-size: 12px;"/>
                        </p:column>
                        <p:column headerText="Titular" style="font-size: 12px; width: 200px;">
                            <h:outputText value="#{c.titular}" style="font-size: 12px;"/>
                        </p:column>
                        <p:column headerText="Contato" style="font-size: 12px; width: 200px;">
                            <h:outputText value="Cel: #{c.address.cellular} Tel: #{c.address.phone} " style="font-size: 12px;"/>
                        </p:column>
                        <p:column headerText="Opções" style="font-size: 12px; width: 70px;">
                            <p:commandButton icon="ui-icon-folder-collapsed" actionListener="#{managerEditNotaryOffice.redirect('editNotaryOffice.xhtml', c)}" title="Editar" />
                            <p:commandButton icon="ui-icon-circle-zoomin" actionListener="#{managerSearchNotaryOffice.redirect('showNotaryOffice.xhtml', c)}" title="Visualizar" />
                            <p:commandButton icon="ui-icon-trash" title="Excluir" update="@form"  />
                        </p:column>
                    </p:dataTable>

                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>

</html>